/*
 *    Copyright (c) 2018-2025, boss All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the boss developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: boss
 */

package com.hopes.bizz.close.basic.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.hopes.bizz.close.common.constant.enums.ParkCloseSysDictEnum;
import com.hopes.bizz.common.core.validate.group.AddGroup;
import com.hopes.bizz.common.core.validate.group.UpdateGroup;
import com.hopes.bizz.video.common.constant.enums.VideoModDictEnum;
import com.hopes.boss.admin.api.resolver.DictResolver;
import com.hopes.boss.admin.api.resolver.enums.AdminDictEnum;
import com.hopes.boss.admin.api.resolver.enums.SysDictEnum;
import com.hopes.boss.common.entity.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * 门禁管理
 *
 * @author pig
 * @date 2023-10-23 10:38:44
 */
@Data
@TableName("closed_access_control")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "门禁管理")
public class ClosedAccessControlEntity extends BaseEntity {

    private static final long serialVersionUID = 1L;


	/**
	* ID
	*/
    @TableId(type = IdType.ASSIGN_ID)
    @Schema(description="ID")
    private Long id;


	/**
	 * 门禁类型
	 */
	@Schema(description="门禁类型")
	private String accessType;


	/**
	 * 联网状态
	 */
	@Schema(description="联网状态")
	private String networkStatus;

	/**
	 * 门禁分类
	 */
	@Schema(description="门禁分类")
	private String accessClassify;

	/**
	* 名称
	*/
    @Schema(description="名称")
	@NotBlank(message = "门禁名称为必填项", groups = {AddGroup.class, UpdateGroup.class})
	@Length(max = 100, message = "门禁名称最大长度为:100", groups = {AddGroup.class, UpdateGroup.class})
    private String name;

	/**
	 * 是否使用
	 */
	@Schema(description="是否使用")
	@NotBlank(message = "是否使用为必填项", groups = {AddGroup.class, UpdateGroup.class})
	@Length(max = 1, message = "是否使用最大长度为:1", groups = {AddGroup.class, UpdateGroup.class})
	private String useFlag;

	/**
	* 门禁位置
	*/
    @Schema(description="门禁位置")
	@NotBlank(message = "门禁位置为必填项", groups = {AddGroup.class, UpdateGroup.class})
	@Length(max = 500, message = "门禁位置最大长度为:500", groups = {AddGroup.class, UpdateGroup.class})
    private String accessLocation;

	/**
	 * 门禁位置描述
	 */
	@Schema(description="门禁位置描述")
	private String accessAddress;


	/**
	 * 车道数
	 */
	@Schema(description="车道数")
	private Integer passNum;


	/**
	 * 车道描述
	 */
	@Schema(description="车道描述")
	private String passDesc;

	/**
	 * 车道图片
	 */
	@Schema(description="车道图片")
	private String passImage;

	/**
	* 最后通行时间
	*/
    @Schema(description="最后通行时间")
    private Date latestPassTime;

	/**
	* 海康编码
	*/
    @Schema(description="海康编码")
	@NotBlank(message = "海康编码为必填项", groups = {AddGroup.class, UpdateGroup.class})
	@Length(max = 255, message = "海康编码最大长度为:255", groups = {AddGroup.class, UpdateGroup.class})
    private String hikIndex;

	/**
	* 海康区域
	*/
    @Schema(description="海康区域")
    private String hikRegionId;

	/**
	* 视频Id
	*/
    @Schema(description="视频Id")
    private String videoId;

	/**
	* 备注
	*/
    @Schema(description="备注")
    private String remark;

	/**
	 * 机构ID
	 */
	@Schema(description="机构ID")
	private Long orgId;


	public String getOrgIdStr() {
		return DictResolver.getItemLabelByValue(AdminDictEnum.sys_company, this.getOrgId());
	}

	public String getUseFlagStr() {
		return DictResolver.getItemLabelByValue(SysDictEnum.yes_no_type, this.getUseFlag());
	}

	public String getAccessTypeStr() {
		return DictResolver.getItemLabelByValue(ParkCloseSysDictEnum.close_park_company_type, this.getAccessType());
	}

	public String getAccessClassifyStr() {
		return DictResolver.getItemLabelByValue(ParkCloseSysDictEnum.close_gate_access_classify, this.getAccessClassify());
	}

	public String getHikRegionIdStr() {
		return DictResolver.getItemLabelByValue(VideoModDictEnum.video_region, this.getHikRegionId());
	}

	public String getVideoIdStr() {
		return DictResolver.getItemLabelByValue(VideoModDictEnum.video, this.getVideoId());
	}

	public String getNetworkStatusStr() {
		return DictResolver.getItemLabelByValue(ParkCloseSysDictEnum.close_device_network_status, this.getNetworkStatus());
	}

}
